# 导包
import requests
import config

# 创建测试类
class CourseAPI:
    #初始化
    def __init__(self):
        self.url_insert = config.BASE_URL + "/api/clues/course"
        self.url_select = config.BASE_URL + "/api/clues/course/list"
        self.url_update = config.BASE_URL + "/api/clues/course"
        self.url_delete = config.BASE_URL + "/api/clues/course/{}"

    # 新增课程
    def insert_course(self,token999,test_data):
        return requests.post(url=self.url_insert,headers={"Authorization":token999},json=test_data)

    # 查询课程列表
    def select_course(self,token999):
        return requests.get(url=self.url_select, headers={"Authorization":token999})

    # 修改课程
    def update_course(self,token999,test_data):
        return requests.put(url=self.url_update, headers={"Authorization":token999}, json=test_data)

    #删除课程
    def delete_course(self,course_id, token999):
        return requests.delete(url=self.url_delete.format(course_id),headers={"Authorization":token999})